#  this file is part of Devsus.
#
#  Copyright 2018 Dima Krasner
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#  MA 02110-1301, USA.

language: bash

matrix:
  include:
    - os: linux
      dist: trusty

services:
  - docker

git:
  depth: 5
  quiet: true

script:
  - docker build -t devsus -f Dockerfile .
  - docker run -e CI -w /root/devsus -v `pwd`:/root/devsus devsus ./devsus.sh

before_deploy:
  - git config --local user.name "Dima Krasner"
  - git config --local user.email "dima@dimakrasner.com"
  - git tag "$TRAVIS_BRANCH-$(git log --format=%h -1)"

deploy:
  provider: releases
  api_key:
    secure: RMyeeVMPZZkUYFzpJKZxIl+zfC9R4OJsU0UOInZ38XGWzo5J07SM4jItd6MPO4H603weMD3KOgiCisjLEeSkhiX5w6FvtYLdcbsQbbniH3x5l5MMVVqr5U0Tava07cVE5saa2TsHfZXnbEvh/X+Bs68R3wBycFo+KLyZ6Q0kbzQXp0RqTOh7FrcT1kEsjjlxbgrDq0yFFXTBLHUfpFPxaKUj9g80xYQztuaOqp27agkL/g4VH8KSw6BhWGjXhaF56G3vVKZ9ObYdqbdwZZrDCICFeCZX36TPZ8jPj3FPxgRIQF0CnaXST2nzskDniY9/UQT0vWuvJWSJ012y/Ky8O0uRU0YxAEXxW1TO4WQllbTcNkMQtYC8wVoB4xzafOrpvvS+6NUuBqTubHKRo4BNhYCvtYxhHhrw6ExW1+O0eioe02SRd7uPyEZ4twjuqYPWT81e7eTi+pSzsGXkFmUhpJHkhNz9EQ7DUOlej1rT3zBea7bE7aW2XtQFUXc1z4nasuxBMGbDOjd+za1Trxg6g+oZHw4t/fQGyrEHMWEtyQ3cpRxzcEi44uXt4JmmGlshl8qxSp6551sEt8NVqi0qoibYHlDNNx2iObpNo/WvRsAJ4YWNQQZ2cTdW4D4NircqDykOO1iquIh4FXACXn4gmISZCv9vKa2DM6jKLCgak+I=
  file:
    - devsus-rootfs.tar.gz
    - devsus-templates.tar.gz
  skip_cleanup: true
  on:
    repo: dimkr/devsus

before_cache:
  - rm -f dl/hosts

cache:
  directories:
    - dl
